import { post } from '@/core/utils/http';
import type { Response, AddressType, CityAddressType } from '@/core/models';

/**  获取用户默认收货地址 */
export const queryUserDefaultShip = () : Promise<Response<AddressType>> => {
	return post('Api/User/GetUserDefaultShip', {}, true);
}

/**  获取用户的收货地址列表 */
export const queryUserShip = () : Promise<Response<Array<AddressType>>> => {
	return post('Api/User/GetUserShip', {}, true);
}

/**  获取省市区 */
export const queryAreas = () : Promise<Response<Array<CityAddressType>>> => {
	return post('Api/Common/GetAreas', {});
}

/** 获取区域ID */
export const queryAreaId = (data : any) : Promise<Response<number>> => {
	return post('Api/User/GetAreaId', { data, });
}

/** 存储用户收货地址 */
export const querySaveUserShip = (data : any) : Promise<Response<any>> => {
	return post('Api/User/SaveUserShip', { data, }, true);
}

/** 收货地址删除 */
export const queryRemoveShip = (data : any) : Promise<Response<any>> => {
	return post('Api/User/RemoveShip', { data, }, true);
}

/** 获取收货地址详情 */
export const queryShipDetail = (data : any) : Promise<Response<any>> => {
	return post('Api/User/GetShipDetail', { data, }, true);
}